<!-- Modal -->
<div class="modal fade " id="addSpecificQuotaTypeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">维护具体绩效指标</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal">
                <div class="box-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">维度</label>
                        <div class="col-sm-7">
                            <input id="specificParentName" type="text" class="form-control" style="width: 100%;"
                                   readonly>
                            <input id="specificParentId" type="hidden">
                            <input id="specificId" type="hidden">
                            <input id="versionId" type="hidden">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">指标名称</label>
                        <div class="col-sm-7">
                            <input id="specificQuotaTypeName" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group" id="specificWeightDiv">
                        <label for="inputEmail3" class="col-sm-2 control-label">指标权重</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="specificStyleValue">
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary pull-right" onclick="saveSpecificQuotaType()">保存
                    </button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>
<script>
    function specificInit() {
        $("#specificId").val("");
        $("#specificQuotaTypeName").val("");
        $("#specificStyleValue").val("");
        $("#specificDescription").val("");
        $("#versionId").val("");
        
    }

    function specificSetValue(data) {
        $("#specificId").val(data.id);
        $("#specificQuotaTypeName").val(data.quotaTypeName);
        $("#specificStyleValue").val(data.styleValue);
        $("#specificDescription").val(data.description);
        $("#versionId").val(data.versionId);
    }


    function saveSpecificQuotaType() {
        var data = {
            id:$("#specificId").val(),
            parentId: $("#specificParentId").val(),
            quotaTypeName: $("#specificQuotaTypeName").val(),
            styleValue: $("#specificStyleValue").val(),
            description: $("#specificDescription").val(),
            versionId: $("#versionId").val()
        };
        var url = "/evaluationquota/add";
        if(data.id != "" && data.id != undefined) {
            url = "/evaluationquota/modify" ;
        }
        postReq(url, data, function (result) {
            if (result.success) {
                toastr['success']('操作成功', '提示');
                refreshTable('table2');
                $("#addSpecificQuotaTypeModal").modal("hide");
            } else {
                toastr['error'](result.msg, '提示');
            }
        });
    }
</script>
